package name.matthewgreet.example9.form; import com.opensymphony.xwork2.TextProvider; import com.opensymphony.xwork2.interceptor.ValidationAware; import name.matthewgreet.strutscommons.annotation.IntegerConversion; import name.matthewgreet.strutscommons.annotation.IntegerRange; import name.matthewgreet.strutscommons.annotation.Required; import name.matthewgreet.strutscommons.form.AbstractFormattableForm; @SuppressWarnings("deprecation") public class RequiredScorePairConversionForm extends AbstractFormattableForm { private static final long serialVersionUID = 4546633634493518786L; @Required(message = "Score is required") @IntegerConversion(message = "Score must be a number between 1 and 10") @IntegerRange(min = 1, max = 10, message = "Score must be a number between 1 and 10") private String score; private int parsedScore; public RequiredScorePairConversionForm() { resetFields(); } @Override public void resetFields() { score = ""; } @Override public void doValidate(ValidationAware validationAware, TextProvider textProvider) { // Empty } public String getScore() { return score; } public void setScore(String score) { this.score = score; } public int getParsedScore() { return parsedScore; } }